<template>
  <div>
    欢迎--{{username}}--来到
    <a-input class="a1" v-model="username" placeholder="请输入用户名">
      <a-icon slot="prefix" type="user"/>
    </a-input>
    <a-input class="a1" v-model="new_username" placeholder="请输入新的用户名"/>
    <br>
    <a-button type="primary" @click="g">
      修改
    </a-button>
    <a-button type="primary" @click="q">
      确定
    </a-button>

  </div>
</template>

<script>
import axios from 'axios'
export default {
  data() {
    return {
      username: "",
      new_username:'',
      username:sessionStorage.getItem('username')
    }
  }, 
  methods: {
      g(){
          axios({
              url:'http://127.0.0.1:8000/updateusername/',
              method:'get',
              params:{'username':this.username,'new_username':this.new_username}
          }).then(res =>{
              console.log(res.data)
              alert('请确定')
          })
      },
      q(){
          axios({
              url:'http://127.0.0.1:8000/getjob/',
              method:'get',
          }).then(res =>{
              console.log(res.data)
              alert(res.data.msg)
          })
      },

  }
}
</script>
<style>
.a1 {
  width: 60%;
  line-height: 50px;
}
</style>